package com.practices.activity;

import javax.crypto.spec.IvParameterSpec;

import com.practice.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;

public class AnimationPractioces extends Activity {
	private Button btn_alpha, btn_scale, btn_translate, btn_rotate;
	private ImageView iv_girl;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.anim_activity);
		initView();

	}

	private void initView() {

		btn_alpha = (Button) findViewById(R.id.btn_alpha);
		btn_scale = (Button) findViewById(R.id.btn_scale);
		btn_translate = (Button) findViewById(R.id.btn_translate);
		btn_rotate = (Button) findViewById(R.id.btn_rotates);

		iv_girl = (ImageView) findViewById(R.id.iv_girl);

		btn_alpha.setOnClickListener(myClickListener);
		btn_scale.setOnClickListener(myClickListener);
		btn_translate.setOnClickListener(myClickListener);
		btn_rotate.setOnClickListener(myClickListener);

	}

	private OnClickListener myClickListener = new OnClickListener() {

		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.btn_alpha:
				Animation alpha = AnimationUtils.loadAnimation(AnimationPractioces.this, R.anim.alphaxml);
				// iv_girl.setAnimation(alpha);
				iv_girl.startAnimation(alpha);
				break;
			case R.id.btn_scale:
				Animation scale = AnimationUtils.loadAnimation(AnimationPractioces.this, R.anim.scaleanim);
				// iv_girl.setAnimation(scale);
				iv_girl.startAnimation(scale);
				break;
			case R.id.btn_translate:
				Animation translate = AnimationUtils.loadAnimation(AnimationPractioces.this, R.anim.translateanim);
				iv_girl.startAnimation(translate);
				break;
			case R.id.btn_rotates:
				Animation rotate = AnimationUtils.loadAnimation(AnimationPractioces.this, R.anim.rotateanmi);
				iv_girl.startAnimation(rotate);
				break;
			default:
				break;
			}
		}
	};

}
